package com.kfm.jdbc.day0406;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;

public class Demo03 {

    public static void main(String[] args) {
        try {
//            InetAddress[] localhosts = InetAddress.getAllByName("www.baidu.com");
//            System.out.println(Arrays.toString(localhosts));
            InetAddress localHost = InetAddress.getLocalHost();
            System.out.println(localHost);

            String hostAddress = localHost.getHostAddress();
            System.out.println(hostAddress);
        } catch (UnknownHostException e) {
            throw new RuntimeException(e);
        }
    }
}
